using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Tool
{
    public class SoundEditorPoint
    {
        public SoundEditorPoint(int x, int y, int width, int height)
        {
            m_x = x;
            m_y = y;
            m_width = width;
            m_height = height;
        }

        public void SetX(int x)
        {
            m_x = x;
        }

        public void SetY(int y)
        {
            m_y = y;
        }

        public float GetNormalizedX()
        {
            return ((float)m_x) / ((float)m_width);
        }

        public float GetNormalizedY()
        {
            return ((float)m_y) / ((float)m_height);
        }

        public Point GetCSharpPt( int width, int height, int xOffset, int yOffset )
        {
            return new Point((int)(xOffset + m_x / (float)m_width * width), 
                (int)(yOffset + m_y / (float)m_height * height));
        }

        public int m_x;
        public int m_y;
        public int m_width;
        public int m_height;
    }

    public class SoundModifier
    {
        EDIT_TYPE m_type;
        public ArrayList m_editPoints = new ArrayList();
        Color m_activeColor;
        Color m_inactiveColor;
        int m_left;
        int m_top;
        int m_width;
        int m_height;

        public SoundModifier(EDIT_TYPE type, int left, int top, int width, int height, bool makePoints)
        {
                // modify for fucking stupid offset shit
            width -= 4;
            height -= 4;


            m_type = type;
            m_left = left;
            m_top = top;
            m_width = width;
            m_height = height;

            if (makePoints)
            {
                m_editPoints.Add(new SoundEditorPoint(0, height / 2, width, height));
                m_editPoints.Add(new SoundEditorPoint(width, height / 2, width, height));
            }

            switch ( type )
            {
                case( EDIT_TYPE.EDIT_VOLUME ):
                   {
                        m_activeColor = Color.Red;
                        m_inactiveColor = Color.LightPink;
                       break;
                   }
                case( EDIT_TYPE.EDIT_PAN ):
                    {
                        m_activeColor = Color.Green;
                        m_inactiveColor = Color.LightGreen;
                        break;
                    }
                case (EDIT_TYPE.EDIT_DISTORTION):
                    {
                        m_activeColor = Color.Blue;
                        m_inactiveColor = Color.LightBlue;
                        break;
                    }
                case (EDIT_TYPE.EDIT_REVERB):
                    {
                        m_activeColor = Color.Black;
                        m_inactiveColor = Color.LightGray;
                        break;
                    }
            }
        }

        public ArrayList GetEditPoints()
        {
            return m_editPoints;
        }

        public Color GetActiveColor()
        {
            return m_activeColor;
        }

        public Color GetInactiveColor()
        {
            return m_inactiveColor;
        }
    }
}
